﻿declare @pageId UNIQUEIDENTIFIER

set @pageId = 'B2F387D8-A03C-44C2-80B6-5F11C06A9716'

select '
if not exists (select 1 from [medianamik_PageInRole] where PageId='''+cast(PageId as varchar(38))+''')
begin
INSERT INTO [medianamik_PageInRole]
           ([PageInRoleId]
           ,[RoleId]
           ,[PageId])
     VALUES
           ('''+cast([PageInRoleId] as varchar(38))+'''
           ,'''+cast([RoleId] as varchar(38))+'''
           ,'''+cast([PageId] as varchar(38))+''')
end'
From [medianamik_PageInRole] 
where PageId = @pageId